package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.MouseBean;
import com.project.service.IMouseService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author RJ
 * @date 2022/9/16 9:37
 */
@RestController
@RequestMapping("mouse")
public class MouseController {
    @Resource
    private IMouseService mouseService;

    @RequestMapping("add")
    public String addMouse(MouseBean mouseBean) {
        mouseService.addMouse(mouseBean);
        return "ok";
    }

    @RequestMapping("get")
    public MouseBean getMouseInfo(Integer mouseId) {
        MouseBean mouseBean = mouseService.getMouseInfo(mouseId);
        return mouseBean;
    }

    @RequestMapping("info")
    public IPage<MouseBean> cutMouseByItem(Integer pageNo, Integer pageSize, String mouseName) {
        IPage<MouseBean> page = mouseService.cutMouseByItem(pageNo, pageSize, mouseName);
        return page;
    }
}
